package com.netposa.datawarehouse.statistics.vo;

import com.netposa.datawarehouse.statistics.utils.NumberUtils;
import java.math.BigDecimal;

public class DeviceStateCountVO {
   private long normal;
   private double normalPer;
   private long abnormal;
   private double abnormalPer;
   private long all;

   public DeviceStateCountVO(long normal, long abnormal) {
      this.normal = normal;
      this.abnormal = abnormal;
      this.all = normal + abnormal;
      this.abnormalPer = NumberUtils.safeDiv(abnormal, this.all, 3);
      this.normalPer = abnormal != 0L ? (new BigDecimal(String.valueOf(1))).subtract(new BigDecimal(String.valueOf(this.abnormalPer))).doubleValue() : 0.0;
   }

   public long getNormal() {
      return this.normal;
   }

   public double getNormalPer() {
      return this.normalPer;
   }

   public long getAbnormal() {
      return this.abnormal;
   }

   public double getAbnormalPer() {
      return this.abnormalPer;
   }

   public long getAll() {
      return this.all;
   }

   public void setNormal(long normal) {
      this.normal = normal;
   }

   public void setNormalPer(double normalPer) {
      this.normalPer = normalPer;
   }

   public void setAbnormal(long abnormal) {
      this.abnormal = abnormal;
   }

   public void setAbnormalPer(double abnormalPer) {
      this.abnormalPer = abnormalPer;
   }

   public void setAll(long all) {
      this.all = all;
   }

   public boolean equals(Object o) {
      if (o == this) {
         return true;
      } else if (!(o instanceof DeviceStateCountVO)) {
         return false;
      } else {
         DeviceStateCountVO other = (DeviceStateCountVO)o;
         if (!other.canEqual(this)) {
            return false;
         } else if (this.getNormal() != other.getNormal()) {
            return false;
         } else if (Double.compare(this.getNormalPer(), other.getNormalPer()) != 0) {
            return false;
         } else if (this.getAbnormal() != other.getAbnormal()) {
            return false;
         } else if (Double.compare(this.getAbnormalPer(), other.getAbnormalPer()) != 0) {
            return false;
         } else {
            return this.getAll() == other.getAll();
         }
      }
   }

   protected boolean canEqual(Object other) {
      return other instanceof DeviceStateCountVO;
   }

   public int hashCode() {
      
      int result = 1;
      long $normal = this.getNormal();
      result = result * 59 + (int)($normal >>> 32 ^ $normal);
      long $normalPer = Double.doubleToLongBits(this.getNormalPer());
      result = result * 59 + (int)($normalPer >>> 32 ^ $normalPer);
      long $abnormal = this.getAbnormal();
      result = result * 59 + (int)($abnormal >>> 32 ^ $abnormal);
      long $abnormalPer = Double.doubleToLongBits(this.getAbnormalPer());
      result = result * 59 + (int)($abnormalPer >>> 32 ^ $abnormalPer);
      long $all = this.getAll();
      result = result * 59 + (int)($all >>> 32 ^ $all);
      return result;
   }

   public String toString() {
      return "DeviceStateCountVO(normal=" + this.getNormal() + ", normalPer=" + this.getNormalPer() + ", abnormal=" + this.getAbnormal() + ", abnormalPer=" + this.getAbnormalPer() + ", all=" + this.getAll() + ")";
   }
}
